package com.example.demo.Springmytbatis.service;

import com.example.demo.Springmytbatis.mapper.UserInfoMapper;
import com.example.demo.Springmytbatis.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserInfoMapper userInfoMapper;
    public List<UserInfo> getAllUser() {
        return userInfoMapper.getAllUser();

    }

    public UserInfo getUserInfoById(Integer id) {
        return userInfoMapper.getUserInfoById(id);

    }

    public List<UserInfo> selectByUserNameandBypassword(String username, String password) {
        List<UserInfo> userInfos = userInfoMapper.selectByUserNameandBypassword(username, password);
        if(userInfos!=null&&userInfos.size()>0){
            return userInfos;
        }else{
            return null;
        }
    }
}
